@extends("layouts.backend.webadmin")

@section('content')

<!-- 主体部分 -->
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <a class="btn btn-primary level-add" href="{{ URL::route('admin.flaw.leveladd') }}" role="button"><i class="fa fa-plus-square" aria-hidden="true"></i> 增加</a>
                    <a class="btn btn-warning level-restore" href="{{ URL::route('admin.flaw.levellist',['type'=>1]) }}" role="button"><i class="fa fa-trash-o" aria-hidden="true"></i> 回收站</a>
                </div>
                <!-- /.box-header -->
                <div class="box-body">
                    <table id="leveltable" class="table table-bordered table-striped">
                        <thead>
                        <tr>
                            <th>#</th>
                            <th>名称</th>
                            <th>级别</th>
                            <th>最少安全币</th>
                            <th>最多安全币</th>
                            <th>最少积分</th>
                            <th>最多积分</th>
                            <th>期限（天）</th>
                            <th>增加时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach ($lists as $list)
                        <tr>
                            <td>{{$list->id}}</td>
                            <td>{{$list->name}}</td>
                            <td>{{$list->level}}</td>
                            <td>{{$list->min_reward}}</td>
                            <td>{{$list->max_reward}}</td>
                            <td>{{$list->min_integ}}</td>
                            <td>{{$list->max_integ}}</td>
                            <td>{{$list->term}}</td>
                            <td>{{$list->created_at}}</td>
                            <td>
                                @if($type==0)
                                <a class="btn btn-primary level-update" href="{{ URL::route('admin.flaw.levelupdate',['id'=>$list->id]) }}" role="button"><i class="fa fa-pencil fa-fw"></i>编辑</a>
                                <a class="btn btn-danger level-delete" href="{{ URL::route('admin.flaw.leveldel',['id'=>$list->id]) }}" role="button"><i class="fa fa-trash-o fa-fw"></i>删除</a>
                                @else
                                <a class="btn btn-primary level-restore" href="{{ URL::route('admin.flaw.levelrestore',['id'=>$list->id]) }}" role="button"><i class="fa fa-pencil fa-fw"></i>恢复</a>
                                <a class="btn btn-danger level-forcedel" href="{{ URL::route('admin.flaw.levelforcedel',['id'=>$list->id]) }}" role="button"><i class="fa fa-trash-o fa-fw"></i>彻底删除</a>
                                @endif
                            </td>
                        </tr>
                        @endforeach
                        </tbody>
                    </table>
                    {{$lists->links()}}
                </div>
                <!-- /.box-body -->
            </div>
            <!-- /.box -->
        </div>
        <!-- /.col -->
    </div>
    <!-- /.row -->
</section>
<!-- 主体部分结束 -->
@stop

@section('javascript-end')
    <script>
        $('#leveltable').DataTable({
            'paging'      : false,
            'lengthChange': false,
            'searching'   : false,
            'ordering'    : false,
            'info'        : false,
            'autoWidth'   : true,
            'pagingType'  : "simple_numbers",  //分页样式：simple,simple_numbers,full,full_numbers
            'oLanguage'   :{
                'sUrl'    : '{{env("APP_ROOT")}}/assets/bootstrap/js/zh_cn.json'
            }
        })
    </script>
@endsection